home *** CD-ROM | disk | FTP | other *** search
/ Chip: 2005 Utilities / CHIP Utilities 2005.7z / CHIP Utilities 2005.iso / images / freesco.igz / freesco.img / router / rc / rc_httpd < prev    next >
Encoding:
Text File  |  2003-04-15  |  744 b   |  38 lines

  1. #!/bin/sh
  2. #
  3. # Start/stop public and control HTTP services
  4.  
  5. . /etc/system.cfg
  6. . /etc/colors
  7.  
  8. fn1()    {
  9.     [ "$1" ] || return
  10.     [ "$LOGHTTP" != n -o "$BOOTMOD" = debug ] || D="-l /dev/null"
  11.     echo -n "Starting $4 HTTP server...        $CR"
  12.     thttpd -p $1 -u $2 -d $3 $D
  13.     = $? "Done $CC port $1"
  14. }
  15. fn2()    { ps | sed -n '/d    thttp/P'; }
  16. stp()    {
  17.     [ "`fn2`" ] || return
  18.     echo -n "Stopping HTTP servers...        "
  19.     killall thttpd
  20.     =
  21. }
  22. str()    {
  23.     [ "`fn2`" ] && return
  24.     [ "$ENAWWA" = n ] || fn1 "${WWAPORT:-82}" root /wwa "control"
  25.     [ "$ENAWWW" = n ] || fn1 "${WWWPORT:-80}" nobody /www "public"
  26. }
  27.  
  28. case "$1" in
  29.  
  30.     start)    str;;
  31.     stop)    stp;;
  32.     restart)stp;str;;
  33.     status)    if [ "`fn2`" ]
  34.             then echo "Running http servers:"; fn2
  35.             else echo No running http servers
  36.         fi;;
  37. esac
  38.